<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<%@ page
	import="org.springframework.security.ui.AbstractProcessingFilter"%>
<%@ page
	import="org.springframework.security.ui.webapp.AuthenticationProcessingFilter"%>
<%@ page import="org.springframework.security.AuthenticationException"%>

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Simple Form with Spring Security</title>


		<link rel="stylesheet" type="text/css"
			href="<c:url value="resources/dijit/themes/tundra/tundra.css"/>" />
		<script type="text/javascript"
			src="<c:url value="/resources/dojo/dojo.js" />">
	
</script>
		<script type="text/javascript"
			src="<c:url value="/resources/spring/Spring.js" />">
	
</script>
		<script type="text/javascript"
			src="<c:url value="/resources/spring/Spring-Dojo.js" />">
	
</script>

		<style type="text/css" media="all">
body {
	background: black url(resource/images/bg_office.04.jpg) no-repeat
		scroll center top;
}

#content {
	color: white;
	position: absolute;
	width: 268px;
	left: 50%;
	top: 50%;
	margin-left: -134px;
	margin-top: -175px;
}

#nice,fieldset {
	opacity: 0.85;
	filter: alpha(opacity =                         85);
	background-color: #CB2D2C;
	padding: 0.5em;
	border-width: thin;
	border-style: solid;
}

.s1 {button .css (line 15) background-color:white;
	border: 1px solid #999999;
	font-size: 0.8em;
	font-weight: bold;
	padding:0.3em 0.11em 0.3em;
}

a:link { 
	color: black;
	float: right;
}  /* default link */
a:visited {
	color: black;
	float: right;
}  /* link that you already visited */
a:active {
	color: black;
	float: right;
} /* active link */
</style>

	</head>
	<body>


		<div id="content">


			<div class="section">
				<c:if test="${not empty param.login_error}">

					<div id="nice" class="errors"
						style="border-width: thin; border-color: white; border-style: solid;">

						Your login attempt was not successful, try again.
						<br />
						<br />
						Reason:
						<%=((AuthenticationException) session
										.getAttribute(AbstractProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY))
										.getMessage()%>

					</div>
					<br />
				</c:if>
			</div>

			<div class="section">
				<form name="f" action="<c:url value="/loginProcess" />"
					method="post">
					<fieldset>
						<div class="field">
							<div class="label">
								<label for="j_username">
									User:
								</label>
							</div>
							<div class="output">
								<input type="text" name="j_username" id="j_username"
									<c:if test="${not empty param.login_error}">value="<%=session
									.getAttribute(AuthenticationProcessingFilter.SPRING_SECURITY_LAST_USERNAME_KEY)%>"</c:if> />
								<script type="text/javascript">
	Spring.addDecoration(new Spring.ElementDecoration( {
		elementId :"j_username",
		widgetType :"dijit.form.ValidationTextBox",
		widgetAttrs : {
			promptMessage :"Your username",
			required :true
		}
	}));
</script>
							</div>
						</div>
						<div class="field">
							<div class="label">
								<label for="j_password">
									Password:
								</label>
							</div>
							<div class="output">
								<input type="password" name="j_password" id="j_password" />
								<script type="text/javascript">
	Spring.addDecoration(new Spring.ElementDecoration( {
		elementId :"j_password",
		widgetType :"dijit.form.ValidationTextBox",
		widgetAttrs : {
			promptMessage :"Your password",
			required :true
		}
	}));
</script>
							</div>
						</div>
						<div class="field">
							<div class="label">
								<label for="remember_me">
									Don't ask for my password for two weeks:
									<a href="<c:url value="/registration.html" />">Register </a>
								</label>
							</div>
							<div class="output">
								<input type="checkbox" name="_spring_security_remember_me"
									id="remember_me" />

							</div>
						</div>
						<div class="form-buttons">
							<div class="button">
								<input class="s1" name="submit" id="submit" type="submit"
									value="Login" />
								<script type="text/javascript">
	Spring.addDecoration(new Spring.ValidateAllDecoration( {
		event :'onclick',
		elementId :'submit'
	}));
</script>
							</div>
						</div>
					</fieldset>
				</form>
			</div>
		</div>



	</body>
</html>
